<?php

function select($name,$where=''){
    header("content-type:text/html;charset=utf8");

    $link =@mysql_connect('127.0.0.1','root','root');
    if(!$link){
        die('连接失败，错误号为：'.mysql_errno().'失败原因：'.mysql_error());
    }
    mysql_select_db('blog')or die('xuankushibai'.mysql_error());
    mysql_set_charset('utf8');
    $sql = "select * from `$name` $where";
//var_dump($sql);die;
     
    $res = mysql_query($sql) ;
    //var_dump($res);die;
    $arr = array();
    while ($row = mysql_fetch_assoc($res)){
        $arr[] = $row;
    }


//var_dump($arr);
mysql_free_result($res);
mysql_close();
return $arr;
}


?>